From 0f7bf7be95864bb165fd52748edba847db2418b3 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 11 May 2016 13:32:40 -0400 Subject: [PATCH] lib: Fix a leak in remote parsing As the docs say, `g_regex_match()` still allocates a match even if it returns `FALSE`. Using `g_autoptr` is just plain better. Closes: #292 Approved by: krnowak --- src/libostree/ostree-repo.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 0cff64e9..f32a4815 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -130,7 +130,7 @@ static OstreeRemote * ost_remote_new_from_keyfile (GKeyFile *keyfile, const gchar *group) { - GMatchInfo *match = NULL; + g_autoptr(GMatchInfo) match = NULL; OstreeRemote *remote; static gsize regex_initialized; @@ -157,8 +157,6 @@ ost_remote_new_from_keyfile (GKeyFile *keyfile, ot_keyfile_copy_group (keyfile, remote->options, group); - g_match_info_unref (match); - return remote; } -- 2.30.2